/**
 * 
 */
package hihocoder;

import java.util.Scanner;

/**
 * @author zhongfang
 *
 */
public class 方格取数 {

	static int[][][][] dp;

	public static int getRes(int[][] A, int i, int j, int x, int y, int n) {
		if (dp[i][j][x][y] != 0) {
			return dp[i][j][x][y];
		}
		if (i == n - 2 && j == n - 1 && x == n - 1 && y == n - 2) {// 可以得到结果
			dp[i][j][x][y] = A[i][j] + A[x][y] + A[n - 1][n - 1] * 2;
			return dp[i][j][x][y];
		}
		// 到达该点，需要加上该点的代价
		int res = A[i][j] + A[x][y];

		// hi向右、下
		int[] pos1 = { i + 1, j };// 下
		int[] pos2 = { i, j + 1 };// 右

		int[] pos3 = { x + 1, y };// 下
		int[] pos4 = { x, y + 1 };// 右

		int tmp = 0;
		if (pos1[0] < n) {
			if (pos3[0] < n) {
				tmp = Math.max(getRes(A, pos1[0], pos1[1], pos3[0], pos3[1], n), tmp);
			}
			if (pos4[1] < n && !(pos1[0] == pos4[0] && pos1[1] == pos4[1])) {
				tmp = Math.max(tmp, getRes(A, pos1[0], pos1[1], pos4[0], pos4[1], n));
			}
		}
		if (pos2[1] < n) {
			if (pos3[0] < n && !(pos2[0] == pos3[0] && pos2[1] == pos3[1])) {// 没有重合
				tmp = Math.max(tmp, getRes(A, pos2[0], pos2[1], pos3[0], pos3[1], n));
			}
			if (pos4[1] < n) {
				tmp = Math.max(tmp, getRes(A, pos2[0], pos2[1], pos4[0], pos4[1], n));
			}
		}
		dp[i][j][x][y] = res + tmp;
		return dp[i][j][x][y];
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int[][] A = new int[N][N];
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < A.length; j++) {
				A[i][j] = scanner.nextInt();
			}
		}
		scanner.close();
		dp = new int[N][N][N][N];
		System.out.println(getRes(A, 0, 1, 1, 0, N) + 2 * A[0][0]);
		// System.out.println(dpSol(A, dp));
	}

	private static int dpSol(int[][] a, int[][][][] dp) {
		int n = a.length;
		dp[n - 2][n - 1][n - 1][n - 2] = a[n - 1][n - 2] + a[n - 2][n - 1] + 2 * a[n - 1][n - 1];
		for (int i = n - 1; i >= 0; i--) {
			for (int j = 0; j < dp.length; j++) {

			}
		}
		return 0;
	}

}
